# -*- coding: utf-8 -*-
# @Time    : 18-7-2 下午9:57
# @Author  : hp
# @Email   : shaoeric@foxmail.com
from openpyxl import Workbook
import os


def writeExcel(tableTitle, tableValues,filename):
    # 获取文件路径
    excelPath = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data')
    excelName = filename + '.xlsx'
    ExcelFullName= os.path.join(excelPath, excelName)

    wb = Workbook()

    ws = wb.active

    for col in range(len(tableTitle)):
        c = col + 1
        ws.cell(row=1, column=c).value = tableTitle[col]

    # 数据表基本信息
    for row in range(len(tableValues)):
        ws.append(tableValues[row])
    wb.save(filename=ExcelFullName)
    return excelName
